<?php
/**
 * Author: Traveler
 * Time  : 2021/9/2 11:57
 */

namespace app\service;


use app\model\UserModel;
use sunshine\basic\RestService;

class UserService extends RestService
{
    /**
     * UserService constructor.
     */
    public function __construct()
    {
        $this->model = new UserModel();
        $this->initialize();
    }

    /**
     * 初始化
     */
    public function initialize()
    {
    }

    /**
     * 创建用户(重写)
     *
     * @param array $data
     * @return bool
     */
    public function create(array $data): bool
    {
        // 新用户添加默认密码
        $data['password'] = encrypt_password('123456');

        return parent::create($data);
    }
}